import { createApp } from 'vue';
import ECharts from 'vue-echarts';
import { use } from 'echarts/core';
import DataVVue3 from '@kjgl77/datav-vue3';
// 拖拽
import Moveable from 'vue3-moveable';
// 标尺画布
import SketchRule from 'vue3-sketch-ruler';
import 'vue3-sketch-ruler/lib/style.css';
// 快照
// import 'default-passive-events';
// 手动引入 ECharts 各模块来减小打包体积
import {
  CanvasRenderer,
} from 'echarts/renderers';
import {
  BarChart,
  LineChart,
  ScatterChart,
  RadarChart,
  PieChart,
} from 'echarts/charts';
import {
  TitleComponent,
  GridComponent,
  TooltipComponent,
  LegendComponent,
} from 'echarts/components';

import pinia from '@/store';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import router from '@/router';
import App from './App.vue';
import '@/assets/styles/main.scss';
import Dragger from 'vue-drag-resize';

import Bar from '@/components/bar-chart.vue';
import AreaChart from '@/components/area.vue';
import FlopChart from '@/components/flop.vue';
import AcrossBar from '@/components/across-bar.vue';
import BubbleChart from '@/components/bubble.vue';
import Radar from '@/components/radar.vue';
import Line from '@/components/line.vue';
import RelationChart from '@/components/relation.vue';
import DoughnutChart from '@/components/3Ddoughnut.vue';

use([
  CanvasRenderer,
  BarChart,
  LineChart,
  ScatterChart,
  RadarChart,
  PieChart,
  GridComponent,
  TooltipComponent,
  TitleComponent,
  LegendComponent,
]);
const app = createApp(App);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app
  .use(router)
  .use(DataVVue3)
  .use(pinia)
  .component('v-chart', ECharts)
  .component('Bar', Bar)
  .component('AreaChart', AreaChart)
  .component('FlopChart', FlopChart)
  .component('AcrossBar', AcrossBar)
  .component('BubbleChart', BubbleChart)
  .component('Radar', Radar)
  .component('Line', Line)
  .component('RelationChart', RelationChart)
  .component('DoughnutChart', DoughnutChart)
  .component('Dragger', Dragger)
  .component('SketchRule', SketchRule)
  .mount('#app');
